var g, app = getApp(), page = app.page, request = app.util.request, route = app.route, toast = app.toast;

page({
    data: {},
    onLoad: function(t) {
        g = this;
    },
    onPullDownRefresh: function() {},
    submit: function(e) {
        var o = this;
        if (!(e = e.detail.value.content || "")) return toast("回复内容不能为空");
        wx.showModal({
            title: "提示",
            cancelText: "取消",
            confirmText: "确认回复",
            confirmColor: g.data.system.foot_color2,
            content: "每个问题您只能回复一次，不可修改\n您确定回复吗？",
            success: function(t) {
                return t.confirm && request({
                    url: "ReplyQuestion",
                    data: {
                        user_id: app.userInfo.id || wx.getStorageSync("userInfo").id,
                        question_id: o.options.id,
                        conetnt: e
                    },
                    method: "POST",
                    success: function(t) {
                        if (1 == t) return toast("回复成功"), setTimeout(function() {
                            route({
                                type: "navigateBack",
                                delat: 1
                            });
                        }, 1500);
                        toast("错误" + t);
                    }
                });
            }
        });
    }
});